﻿using EDMDesigner.Designer.Controls.Mapping.Resources;
using System;
using EDMDesigner.Business.MSL.Condition;

namespace EDMDesigner.Designer.Controls.Mapping
{
    public class ColumnConditionComboBox : ColumnComboBox
    {
        protected override string NullValueText
        {
            get { return MappingResources.NullValueDelete; }
        }

        protected override void OnColumnComboBoxValueChanged(Business.SSDL.Property.Property column)
        {
            ((ColumnConditionMapping)DataContext).Column = column;
            Column = column;
            if (column == null)
                OnDelete();
        }

        protected virtual void OnDelete()
        {
            if (Deleted != null)
                Deleted((Business.MSL.Condition.ColumnConditionMapping)DataContext);
        }
        public event Action<Business.MSL.Condition.ColumnConditionMapping> Deleted;
    }
}
